/*
 * ModelListeners.java
 * 
 * 02/11/2009
 */
package kg.sound.player;

import java.util.List;
import java.util.Vector;

/**
 * @author fernando
 */
public class ModelListeners implements ModelListener {

	private final List<ModelListener> listeners = new Vector<ModelListener>();

	public List<ModelListener> getListeners() {
		return listeners;
	}

	public void add(ModelListener l) {
		getListeners().add(l);
	}

	public void remove(ModelListener l) {
		getListeners().remove(l);
	}

	public void removeAll() {
		getListeners().clear();
	}

	public void firePlaylistChanged() {
		playlistChanged();
	}

	public void fireClipStarted() {
		clipStarted();
	}

	public void fireClipStopped() {
		clipStopped();
	}

	/** {@inheritDoc} */
	@Override
	public void playlistChanged() {
		for (ModelListener l : getListeners()) {
			l.playlistChanged();
		}
	}

	/** {@inheritDoc} */
	@Override
	public void clipStarted() {
		for (ModelListener l : getListeners()) {
			l.clipStarted();
		}
	}

	/** {@inheritDoc} */
	@Override
	public void clipStopped() {
		for (ModelListener l : getListeners()) {
			l.clipStopped();
		}
	}

}
